﻿using Common.Data.Extensions;
using CrossSelling.Core.Configuration;
using CrossSelling.Model.Model;

namespace CrossSelling.Core.Data.DBConfig
{
    public class PreApprovedCreditCard87Configuration : DBConfig<PreApprovedCreditCard87>
    {
        public PreApprovedCreditCard87Configuration()
            : base(SystemConfiguration.Schema, SystemConfiguration.NamingType, SystemConfiguration.TABLE_PREFIX)
        {
            HasKey(k => new { k.Cif });

            //relationship
            HasOptional(b => b.Branchs).WithMany(c => c.PreApprovedCreditCard87s).HasForeignKey(k => new { k.BranchId }).WillCascadeOnDelete(false);
            HasRequired(t => t.Customers).WithOptional(c => c.PreApprovedCreditCard87s).WillCascadeOnDelete(false);
            //HasRequired(t => t.Branch).WithMany(c => c.CustomerRegions).HasForeignKey(t => new { t.BranchId }).WillCascadeOnDelete(false);
        }
    }
}
